<template>
  <!-- 权限列表 -->
  <div class="rights">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="content">
      <!-- =============================表格========================= -->
      <el-table :data="tableData" stripe style="width: 100%" border>
        <el-table-column type="index" label="#" width="50"></el-table-column>
        <el-table-column prop="authName" label="权限名称" width="">
        </el-table-column>
        <el-table-column prop="path" label="路径" width=""> </el-table-column>
        <el-table-column label="权限等级">
          <template slot-scope="scope">
            <el-tag
              :type="
                scope.row.level == '0'
                  ? 'primary'
                  : '' || scope.row.level == '1'
                  ? 'success'
                  : '' || scope.row.level == '2'
                  ? 'warning'
                  : ''
              "
              >{{
                scope.row.level == "0"
                  ? "一级"
                  : "" || scope.row.level == "1"
                  ? "二级"
                  : "" || scope.row.level == "2"
                  ? "三级"
                  : ""
              }}</el-tag
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
 
<script>
import { All } from "../../utils/API";
export default {
  name: "rights",
  data() {
    return {
      //  渲染数据
      tableData: [],
    };
  },
  async created() {
    let res = await All(`rights/list`, {}, "GET");
    this.tableData = res.data.data;
    console.log(res);
  },
  mounted() {},
  methods: {},
};
</script>
 
<style lang = "scss" scoped>
.rights {
  width: 100%;
  height: 100%;
  background-color: #eaedf1;
  .el-breadcrumb {
    line-height: 50px;
    text-indent: 1em;
  }
  .content {
    width: 95%;
    background-color: white;
    box-sizing: border-box;
    padding: 20px;
    margin: 0 auto;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) !important;
  }
}
</style>